package com.shujia.flink.transformation

import org.apache.flink.api.common.functions.FilterFunction
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}

object Demo2Filter {
  def main(args: Array[String]): Unit = {

    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment


    val ds1: DataStream[String] = env.socketTextStream("master", 9999)


    ds1.filter(new FilterFunction[String] {

      override def filter(value: String): Boolean = {
        value.equals("java")
      }
    })
      .print()

    env.execute()

  }

}
